package cn.maxhou.t0002;

import cn.maxhou.t0001.Counter;
import cn.maxhou.t0002.CounterFactory;

public class apps {
    public static void main(String[] args) {
        Counter counter1 = CounterFactory.getInstance("+");
        Counter counter2 = CounterFactory.getInstance("-");
        Counter counter3 = CounterFactory.getInstance("*");
        Counter counter4 = CounterFactory.getInstance("/");
        Counter counter5 = CounterFactory.getInstance("%");


        CounterServiceImpl service1 = new CounterServiceImpl();
        CounterServiceImpl service2 = new CounterServiceImpl();
        CounterServiceImpl service3 = new CounterServiceImpl();
        CounterServiceImpl service4 = new CounterServiceImpl();
        CounterServiceImpl service5 = new CounterServiceImpl();
        service1.setCounter(counter1);
        service2.setCounter(counter2);
        service3.setCounter(counter3);
        service4.setCounter(counter4);
        service5.setCounter(counter5);

        System.out.println("加法运行结果为: "+service1.count(5.00,6));
        System.out.println("减法运行结果为: "+service2.count(5.00,6));
        System.out.println("乘法运行结果为: "+service3.count(5.00,6));
        System.out.println("除法运行结果为: "+service4.count(5.00,6));
        System.out.println("取模运算结果为: "+service5.count(11,5));
    }
}
